distance formula and midpoint